<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>预算定制</title>
<%@include file="/common/meta.jsp"%>
<%@include file="/common/validator.jsp"%>
<style type="text/css">
.budgetItem {
	width: 100px;
	border: 0px;
	border-bottom: 1px solid #CCC;
	color: green;
	font-weight: bold;
	padding-left: 3px;
	margin-left: 2px;
}

#budgetTable{
	line-height:25px;
	margin:auto;
	border-top: 1px solid #C0C0C0;
	border-left: 1px solid #C0C0C0;
}

#budgetTable tr td{
    padding: 2px;
	border-bottom: 1px solid #C0C0C0;
	border-right: 1px solid #C0C0C0;
}

#noBorder{
	border: 0px;
}

.errorMsg {
	width: 500px;
	height: 100px;
	color: red;
	text-align: left;
	padding: 20px 5px;
	border: 1px solid #CCC;
}
</style>
</head>
<body>
<div class="x-panel">
<div class="x-panel-header" style="border-bottom: 1px solid #97B7E7;">预算定制</div>
<div align="center" style="padding-top:10px;">
  <s:form action="save.do" method="post">
  <s:hidden name="model.id" />
  <s:if test="hasActionErrors()">
  	<div class="errorMsg">
	  <s:iterator value="actionErrors">
        <img src="${ctx}/images/icons/warning.gif" class="icon" />
        <s:property escape="false"/>...<br>
      </s:iterator>
    </div>
  </s:if>
  <s:else>
    <table id="budgetTable" width="600" align="center" cellspacing="0" cellpadding="0">
      <tr>
		<td align="right" width="100" class="leftBorder">预算编号：</td>
		<td width="500">
		  <s:textfield name="model.singleNo" cssStyle="border:0px;"></s:textfield>
		</td>
	  </tr>
	  <tr>
		<td align="right" width="100" class="leftBorder">部门名称：</td>
		<td width="500">
			${model.dept.name }
			<s:hidden name="model.dept.id"/>
		    <s:hidden name="model.year"/>
		</td>
	  </tr>
	  <tr>
	    <td align="right" width="100" class="leftBorder">预算年度：</td>
	    <td>
	      <span style="font-weight: bold; color: red;">${model.year}年</span>
	      &nbsp;&nbsp;&nbsp;&nbsp;
	      <span>预算周期</span>：
	      <input type="radio" id="month" name="model.btype" value="month" checked="checked" style="border: 0px;">月度
	      <input type="radio" id="quarter" name="model.btype" value="quarter" style="border: 0px;">季度
	    </td>
	  </tr>
	  <tr>
	    <td align="right" valign="top" class="topBorder leftBorder">预算科目：</td>
	    <td class="topBorder" valign="top">
	        <s:if test="model.dept.items.size != 0">
	          <table style="margin: auto;">
		        <s:iterator value="model.dept.items" var="item">
	              <tr>
	                <td align="right" style="border:0px;">${item.name} / ${item.code}：</td>
	                <td style="border:0px;">
	                  <input type="text" name="itemAmount_${item.id}" class="budgetItem" value="0.00" maxlength="12"/>
	                  <font color="green"><b>元</b></font>
	                </td>
	              </tr>
		        </s:iterator>
	          </table>
		    </s:if>
		    <s:else>
		      &nbsp;该部门尚未配置可定制预算科目
		    </s:else>
	    </td>
	  </tr>
	</table>
	<div style="text-align: center;"><br>
	  <input type="submit" value="保存" class="button" /> &nbsp;&nbsp;
	  <input type="button" value="返回" class="button" onclick="javascript:history.back();">
	</div>
  </s:else>
  </s:form>
  <script type="text/javascript">
    var deptBudgetType = "${model.dept.budgetType}";
    if (deptBudgetType == "month"){
    	document.getElementById("month").checked = "checked";
    }else{
    	document.getElementById("quarter").checked = "checked";
    }
  </script>
</div>
</div>
</body>
</html>